/**
 * Created by vision on 16/1/30.
 *
 * 登陆
 * @param $http
 * @param Session
 * @returns {{}}
 */
/* @ngInject */
module.exports = function ($http,$q,httpservice) {
    var loginService = {};
    loginService.login = function (phone,email,pwd,num,code) {
        var params={"registtype":num,"password":pwd,"cellphone":phone,"email":email,"code":code};
        var deferred = $q.defer();
        $http({
            method: 'POST',
            url: httpservice.loginUrl,
            data:params,
            headers : {'Content-Type':'application/json'}
        }).then(function successCallback(response) {
            deferred.resolve(response.data);
        }, function errorCallback(response) {
            deferred.reject(response);
        });
        return deferred.promise;
    };
    return loginService;
};
